package com.chy.线程;

public class 线程 {
    private static boolean run = true;
    public static void main(String[] args) throws InterruptedException {
        Thread t1 = new Thread(() -> {
            while (run) {
                //System.out.println(run);
            }
        });
        t1.start();
        Thread t3 = new Thread(){
            @Override
            public void run() {
                System.out.println("12");
            }
        };
        t3.start();

        Runnable r = () -> {
            System.out.println("33");
        };
        new Thread(r).start();

        Thread.sleep(1000);
        Thread t2 = new Thread(() -> {
            run = false;
            System.out.println("时间到，线程2设置为false");
        });
        t2.start();
    }
}
